MuntasirHossain
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -96,19 +96,24 @@ def generate(prompt, history, max_new_tokens=256): # temperature=0.95, top_p=0.9
|
|
96 |
|
97 |
formatted_prompt = format_prompt(prompt, history)
|
98 |
|
99 |
-
|
|
|
|
|
|
|
|
|
|
|
100 |
# output = ""
|
101 |
# for chunk in response:
|
102 |
# output += chunk.token.text
|
103 |
# yield output
|
104 |
# return output
|
105 |
|
106 |
-
response = llm(formatted_prompt, **kwargs)
|
107 |
-
return response['choices'][0]['text']
|
108 |
|
109 |
chatbot = gr.Chatbot(height=500)
|
110 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
111 |
-
gr.HTML("<center><h1>
|
112 |
gr.ChatInterface(
|
113 |
generate,
|
114 |
chatbot=chatbot,
|
|
|
96 |
|
97 |
formatted_prompt = format_prompt(prompt, history)
|
98 |
|
99 |
+
response = llm(formatted_prompt, **kwargs, stream=True)
|
100 |
+
output = ""
|
101 |
+
for chunk in response:
|
102 |
+
output += chunk['choices'][0]['text']
|
103 |
+
yield output
|
104 |
+
return output
|
105 |
# output = ""
|
106 |
# for chunk in response:
|
107 |
# output += chunk.token.text
|
108 |
# yield output
|
109 |
# return output
|
110 |
|
111 |
+
# response = llm(formatted_prompt, **kwargs)
|
112 |
+
# return response['choices'][0]['text']
|
113 |
|
114 |
chatbot = gr.Chatbot(height=500)
|
115 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
116 |
+
gr.HTML("<center><h1>Fine-tuned Meta-Llama-3-8B</h1><center>")
|
117 |
gr.ChatInterface(
|
118 |
generate,
|
119 |
chatbot=chatbot,
|