Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -9,16 +9,24 @@ except subprocess.CalledProcessError as e:
|
|
9 |
print("Error:", e)
|
10 |
print(e.stderr)
|
11 |
|
12 |
-
|
13 |
def chatbot(prompt):
|
14 |
-
|
15 |
-
command = ["./run", "stories15M.bin", "-t", "0.8", "-p", "0.9", "-n", "256", "-i", f'"{prompt}"']
|
16 |
try:
|
17 |
result = subprocess.run(command, capture_output=True, text=True, check=True, shell=False)
|
18 |
response = result.stdout
|
19 |
except subprocess.CalledProcessError as e:
|
20 |
response = "Error occurred while processing the request."
|
21 |
return response
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
-
iface = gr.Interface(fn=chatbot, inputs="text", outputs="text", live=True)
|
24 |
-
iface.launch()
|
|
|
9 |
print("Error:", e)
|
10 |
print(e.stderr)
|
11 |
|
|
|
12 |
def chatbot(prompt):
|
13 |
+
command = ["./run", "stories15M.bin", "-t", "0.8", "-p", "0.9", "-n", "256", "-i", f"{prompt}"]
|
|
|
14 |
try:
|
15 |
result = subprocess.run(command, capture_output=True, text=True, check=True, shell=False)
|
16 |
response = result.stdout
|
17 |
except subprocess.CalledProcessError as e:
|
18 |
response = "Error occurred while processing the request."
|
19 |
return response
|
20 |
+
|
21 |
+
|
22 |
+
|
23 |
+
with gr.Blocks() as demo:
|
24 |
+
gr.Markdown("HF Spaces for TinyStories")
|
25 |
+
with gr.Row():
|
26 |
+
inp = gr.Textbox(placeholder="Type the beginning of the story")
|
27 |
+
out = gr.Textbox()
|
28 |
+
btn = gr.Button("Run")
|
29 |
+
btn.click(fn=chatbot, inputs=inp, outputs=out)
|
30 |
+
|
31 |
+
demo.launch()
|
32 |
|
|
|
|