Commit
·
533b084
1
Parent(s):
db0a34f
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,7 @@
|
|
| 1 |
from huggingface_hub import InferenceClient
|
| 2 |
import gradio as gr
|
|
|
|
|
|
|
| 3 |
|
| 4 |
client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
|
| 5 |
|
|
@@ -66,7 +68,16 @@ def generate(prompt, history, system_prompt, temperature=0.2, max_new_tokens=512
|
|
| 66 |
yield output
|
| 67 |
return output
|
| 68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
additional_inputs=[
|
| 71 |
gr.Textbox(
|
| 72 |
label="System Prompt",
|
|
@@ -114,7 +125,7 @@ additional_inputs=[
|
|
| 114 |
mychatbot = gr.Chatbot(
|
| 115 |
avatar_images=["./user.png", "./botm.png"], bubble_full_width=False, show_label=False, show_copy_button=True, likeable=False)
|
| 116 |
|
| 117 |
-
demo = gr.ChatInterface(fn=
|
| 118 |
chatbot=mychatbot,
|
| 119 |
additional_inputs=additional_inputs,
|
| 120 |
title="Kamran's Mixtral 8x7b Chat",
|
|
|
|
| 1 |
from huggingface_hub import InferenceClient
|
| 2 |
import gradio as gr
|
| 3 |
+
import streamlit as st
|
| 4 |
+
import requests
|
| 5 |
|
| 6 |
client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
|
| 7 |
|
|
|
|
| 68 |
yield output
|
| 69 |
return output
|
| 70 |
|
| 71 |
+
def generateS(prompt, history, system_prompt, temperature=0.2, max_new_tokens=512, top_p=0.95, repetition_penalty=1.0):
|
| 72 |
+
|
| 73 |
+
stream = search_url(prompt)
|
| 74 |
+
# output = ""
|
| 75 |
|
| 76 |
+
# for response in stream:
|
| 77 |
+
# output += response.token.text
|
| 78 |
+
# yield output
|
| 79 |
+
return stream
|
| 80 |
+
|
| 81 |
additional_inputs=[
|
| 82 |
gr.Textbox(
|
| 83 |
label="System Prompt",
|
|
|
|
| 125 |
mychatbot = gr.Chatbot(
|
| 126 |
avatar_images=["./user.png", "./botm.png"], bubble_full_width=False, show_label=False, show_copy_button=True, likeable=False)
|
| 127 |
|
| 128 |
+
demo = gr.ChatInterface(fn=generateS,
|
| 129 |
chatbot=mychatbot,
|
| 130 |
additional_inputs=additional_inputs,
|
| 131 |
title="Kamran's Mixtral 8x7b Chat",
|