Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,9 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import BlenderbotTokenizer, BlenderbotForConditionalGeneration
|
|
|
|
| 3 |
tokenizer = BlenderbotTokenizer.from_pretrained("facebook/blenderbot-400M-distill")
|
| 4 |
model = BlenderbotForConditionalGeneration.from_pretrained("facebook/blenderbot-400M-distill")
|
| 5 |
|
| 6 |
-
st.title("Hello Mate!!😁")
|
| 7 |
-
|
| 8 |
def chat_with_model(input_text):
|
| 9 |
input_ids = tokenizer.encode("You: " + input_text, return_tensors="pt", max_length=512, truncation=True)
|
| 10 |
response_ids = model.generate(input_ids, max_length=100, num_return_sequences=1, no_repeat_ngram_size=2)
|
|
@@ -15,6 +14,7 @@ iface = gr.Interface(
|
|
| 15 |
fn=chat_with_model,
|
| 16 |
inputs=gr.Textbox(prompt="You:"),
|
| 17 |
outputs=gr.Textbox(prompt="Bot:"),
|
|
|
|
| 18 |
)
|
| 19 |
|
| 20 |
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import BlenderbotTokenizer, BlenderbotForConditionalGeneration
|
| 3 |
+
|
| 4 |
tokenizer = BlenderbotTokenizer.from_pretrained("facebook/blenderbot-400M-distill")
|
| 5 |
model = BlenderbotForConditionalGeneration.from_pretrained("facebook/blenderbot-400M-distill")
|
| 6 |
|
|
|
|
|
|
|
| 7 |
def chat_with_model(input_text):
|
| 8 |
input_ids = tokenizer.encode("You: " + input_text, return_tensors="pt", max_length=512, truncation=True)
|
| 9 |
response_ids = model.generate(input_ids, max_length=100, num_return_sequences=1, no_repeat_ngram_size=2)
|
|
|
|
| 14 |
fn=chat_with_model,
|
| 15 |
inputs=gr.Textbox(prompt="You:"),
|
| 16 |
outputs=gr.Textbox(prompt="Bot:"),
|
| 17 |
+
title="Hello Mate!! 😁" # Add the title here
|
| 18 |
)
|
| 19 |
|
| 20 |
iface.launch()
|