Spaces:
Runtime error
Runtime error
lhl
commited on
Commit
•
45c171e
1
Parent(s):
5835e21
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,8 @@ import gradio as gr
|
|
4 |
from transformers import pipeline, Conversation
|
5 |
|
6 |
model = "mistralai/Mistral-7B-Instruct-v0.1"
|
|
|
|
|
7 |
model = "TinyLlama/TinyLlama-1.1B-Chat-v0.3"
|
8 |
|
9 |
title = "Shisa 7B"
|
@@ -19,12 +21,6 @@ examples = [
|
|
19 |
# Docs: https://github.com/huggingface/transformers/blob/main/src/transformers/pipelines/conversational.py
|
20 |
conversation = Conversation()
|
21 |
chatbot = pipeline('conversational', model)
|
22 |
-
'''
|
23 |
-
conversation = Conversation("Going to the movies tonight - any suggestions?")
|
24 |
-
conversation.add_message({"role": "assistant", "content": "The Big lebowski."})
|
25 |
-
conversation.add_message({"role": "user", "content": "Is it good?"})
|
26 |
-
conversation.messages[:-1]
|
27 |
-
'''
|
28 |
|
29 |
def chat(input, history=[]):
|
30 |
conversation.add_message({"role": "user", "content": input})
|
@@ -51,29 +47,5 @@ gr.ChatInterface(
|
|
51 |
clear_btn="Clear",
|
52 |
).launch()
|
53 |
|
54 |
-
'''
|
55 |
-
gr.Interface.load(
|
56 |
-
"EleutherAI/gpt-j-6B",
|
57 |
-
inputs=gr.Textbox(lines=5, label="Input Text"),
|
58 |
-
title=title,
|
59 |
-
description=description,
|
60 |
-
article=article,
|
61 |
-
).launch()
|
62 |
-
|
63 |
-
|
64 |
-
# Doesn't support conversational pipelin
|
65 |
-
pipe = pipeline('conversational', model)
|
66 |
-
gr.Interface.from_pipeline(pipe).launch()
|
67 |
-
|
68 |
-
|
69 |
-
'''
|
70 |
-
|
71 |
-
|
72 |
# For async
|
73 |
-
# ).queue().launch()
|
74 |
-
|
75 |
-
'''
|
76 |
-
# Pipeline doesn't support conversational...
|
77 |
-
pipe = pipeline("conversational", model=model)
|
78 |
-
demo = gr.Interface.from_pipeline(pipe)
|
79 |
-
'''
|
|
|
4 |
from transformers import pipeline, Conversation
|
5 |
|
6 |
model = "mistralai/Mistral-7B-Instruct-v0.1"
|
7 |
+
|
8 |
+
# Test Model
|
9 |
model = "TinyLlama/TinyLlama-1.1B-Chat-v0.3"
|
10 |
|
11 |
title = "Shisa 7B"
|
|
|
21 |
# Docs: https://github.com/huggingface/transformers/blob/main/src/transformers/pipelines/conversational.py
|
22 |
conversation = Conversation()
|
23 |
chatbot = pipeline('conversational', model)
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
def chat(input, history=[]):
|
26 |
conversation.add_message({"role": "user", "content": input})
|
|
|
47 |
clear_btn="Clear",
|
48 |
).launch()
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
# For async
|
51 |
+
# ).queue().launch()
|
|
|
|
|
|
|
|
|
|
|
|