Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -24,17 +24,11 @@ image_gradio_app = gr.Interface(
|
|
24 |
tokenizer = AutoTokenizer.from_pretrained("microsoft/DialoGPT-medium")
|
25 |
chatbot_model = AutoModelForCausalLM.from_pretrained("microsoft/DialoGPT-medium")
|
26 |
|
27 |
-
def
|
28 |
-
|
29 |
-
bot_input_ids = torch.cat([torch.LongTensor(history), new_user_input_ids], dim=-1)
|
30 |
-
history = chatbot_model.generate(bot_input_ids, max_length=1000, pad_token_id=tokenizer.eos_token_id).tolist()
|
31 |
-
response = tokenizer.decode(history[0]).split("")
|
32 |
-
|
33 |
-
response_tuples = [(response[i], response[i+1]) for i in range(0, len(response)-1, 2)]
|
34 |
-
return response_tuples, history
|
35 |
|
36 |
chatbot_gradio_app = gr.ChatInterface(
|
37 |
-
fn=
|
38 |
title="Greta",
|
39 |
theme=theme
|
40 |
)
|
@@ -42,6 +36,6 @@ chatbot_gradio_app = gr.ChatInterface(
|
|
42 |
# Combine both interfaces into a single app
|
43 |
gr.TabbedInterface(
|
44 |
[image_gradio_app, chatbot_gradio_app],
|
45 |
-
tab_names=["
|
46 |
theme=theme
|
47 |
).launch()
|
|
|
24 |
tokenizer = AutoTokenizer.from_pretrained("microsoft/DialoGPT-medium")
|
25 |
chatbot_model = AutoModelForCausalLM.from_pretrained("microsoft/DialoGPT-medium")
|
26 |
|
27 |
+
def echo(message, history):
|
28 |
+
return message
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
chatbot_gradio_app = gr.ChatInterface(
|
31 |
+
fn=echo,
|
32 |
title="Greta",
|
33 |
theme=theme
|
34 |
)
|
|
|
36 |
# Combine both interfaces into a single app
|
37 |
gr.TabbedInterface(
|
38 |
[image_gradio_app, chatbot_gradio_app],
|
39 |
+
tab_names=["Greta Image","Greta Chat"],
|
40 |
theme=theme
|
41 |
).launch()
|