Spaces:
Runtime error
Runtime error
Upload with huggingface_hub
Browse files
app.py
CHANGED
@@ -38,6 +38,11 @@ class ChatPrompt(minichain.TemplatePrompt):
|
|
38 |
result = out.split("Assistant:")[-1]
|
39 |
return inp.push(result)
|
40 |
|
|
|
|
|
|
|
|
|
|
|
41 |
fake_human = [
|
42 |
"I want you to act as a Linux terminal. I will type commands and you will reply with what the terminal should show. I want you to only reply with the terminal output inside one unique code block, and nothing else. Do not write explanations. Do not type commands unless I instruct you to do so. When I need to tell you something in English I will do so by putting text inside curly brackets {like this}. My first command is pwd.",
|
43 |
"ls ~",
|
@@ -51,13 +56,13 @@ fake_human = [
|
|
51 |
|
52 |
with minichain.start_chain("chatgpt") as backend:
|
53 |
prompt = ChatPrompt(backend.OpenAI())
|
|
|
54 |
state = State([])
|
55 |
-
for
|
56 |
-
|
57 |
-
display(Markdown(f'**Human:** <span style="color: blue">{t}</span>'))
|
58 |
-
|
59 |
-
display(Markdown(f'
|
60 |
-
display(Markdown(f'--------------'))
|
61 |
|
62 |
|
63 |
# + tags=["hide_inp"]
|
|
|
38 |
result = out.split("Assistant:")[-1]
|
39 |
return inp.push(result)
|
40 |
|
41 |
+
class Human(minichain.Prompt):
|
42 |
+
def parse(self, out: str, inp: State) -> State:
|
43 |
+
return inp.human_input = out
|
44 |
+
|
45 |
+
|
46 |
fake_human = [
|
47 |
"I want you to act as a Linux terminal. I will type commands and you will reply with what the terminal should show. I want you to only reply with the terminal output inside one unique code block, and nothing else. Do not write explanations. Do not type commands unless I instruct you to do so. When I need to tell you something in English I will do so by putting text inside curly brackets {like this}. My first command is pwd.",
|
48 |
"ls ~",
|
|
|
56 |
|
57 |
with minichain.start_chain("chatgpt") as backend:
|
58 |
prompt = ChatPrompt(backend.OpenAI())
|
59 |
+
human = Human(backend.Mock(fake_human))
|
60 |
state = State([])
|
61 |
+
for i in range(len(fake_human)):
|
62 |
+
human.chain(prompt)
|
63 |
+
# display(Markdown(f'**Human:** <span style="color: blue">{t}</span>'))
|
64 |
+
# display(Markdown(f'**Assistant:** {state.memory[-1][1]}'))
|
65 |
+
# display(Markdown(f'--------------'))
|
|
|
66 |
|
67 |
|
68 |
# + tags=["hide_inp"]
|