Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,7 @@ import gradio as gr
|
|
| 2 |
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
| 3 |
from pathlib import Path
|
| 4 |
import pandas as pd
|
|
|
|
| 5 |
|
| 6 |
model_checkpoint = "HuggingFaceTB/SmolLM-1.7B"
|
| 7 |
model = AutoModelForCausalLM.from_pretrained(model_checkpoint)
|
|
@@ -48,7 +49,7 @@ with gr.Blocks() as demo:
|
|
| 48 |
chatbot1 = gr.Chatbot()
|
| 49 |
msg = gr.Textbox()
|
| 50 |
clear = gr.ClearButton([msg, chatbot])
|
| 51 |
-
|
| 52 |
def respond(message, chat_history):
|
| 53 |
response = pipe(message)
|
| 54 |
bot_message = response[0]["generated_text"]
|
|
|
|
| 2 |
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
| 3 |
from pathlib import Path
|
| 4 |
import pandas as pd
|
| 5 |
+
import spaces
|
| 6 |
|
| 7 |
model_checkpoint = "HuggingFaceTB/SmolLM-1.7B"
|
| 8 |
model = AutoModelForCausalLM.from_pretrained(model_checkpoint)
|
|
|
|
| 49 |
chatbot1 = gr.Chatbot()
|
| 50 |
msg = gr.Textbox()
|
| 51 |
clear = gr.ClearButton([msg, chatbot])
|
| 52 |
+
@spaces.GPU(duration=200)
|
| 53 |
def respond(message, chat_history):
|
| 54 |
response = pipe(message)
|
| 55 |
bot_message = response[0]["generated_text"]
|