Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
# Combined Interface
|
2 |
import gradio as gr
|
3 |
from transformers import pipeline, AutoModelForCausalLM, AutoTokenizer
|
4 |
import torch
|
@@ -30,15 +29,17 @@ def predict_chatbot(input, history=[]):
|
|
30 |
response_tuples = [(response[i], response[i+1]) for i in range(0, len(response)-1, 2)]
|
31 |
return response_tuples, history
|
32 |
|
33 |
-
chatbot_gradio_app = gr.
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
)
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline, AutoModelForCausalLM, AutoTokenizer
|
3 |
import torch
|
|
|
29 |
response_tuples = [(response[i], response[i+1]) for i in range(0, len(response)-1, 2)]
|
30 |
return response_tuples, history
|
31 |
|
32 |
+
chatbot_gradio_app = gr.Blocks()
|
33 |
+
with chatbot_gradio_app as demo:
|
34 |
+
chatbot = gr.Chatbot()
|
35 |
+
state = gr.State([])
|
36 |
+
with gr.Row():
|
37 |
+
txt = gr.Textbox(show_label=False, placeholder="Enter text and press enter")
|
38 |
+
txt.submit(predict_chatbot, [txt, state], [chatbot, state])
|
39 |
+
|
40 |
+
# Launch both interfaces
|
41 |
+
if __name__ == "__main__":
|
42 |
+
gr.Interface(
|
43 |
+
columns=2,
|
44 |
+
children=[image_gradio_app, chatbot_gradio_app]
|
45 |
+
).launch()
|