Spaces:
Runtime error
Runtime error
chat from gradio
Browse files
app.py
CHANGED
@@ -1,3 +1,16 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
import pip
|
3 |
+
from transformers import pipeline
|
4 |
|
5 |
+
model_name_or_path = "dgnk007/crow"
|
6 |
+
|
7 |
+
|
8 |
+
def chatbot(message, history):
|
9 |
+
prompt_template=f'''instruct: {message}
|
10 |
+
Human:
|
11 |
+
'''
|
12 |
+
generate=pipeline('text-generation',model=model_name_or_path)
|
13 |
+
response=generate(prompt_template,max_length=128,return_full_text=False)
|
14 |
+
return response[0].generated_text
|
15 |
+
|
16 |
+
gr.ChatInterface(chatbot).launch()
|