Spaces:
Build error
Build error
Commit
·
b91d77f
1
Parent(s):
8db8595
Update run.py
Browse files
run.py
CHANGED
|
@@ -2,24 +2,14 @@ import gradio as gr
|
|
| 2 |
import requests
|
| 3 |
import random
|
| 4 |
import json
|
| 5 |
-
def response(message, history,prompt_type
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
prompt_type="Alpaca"
|
| 9 |
-
if(model=="SauerkrautLM-7B"):
|
| 10 |
-
url="https://SauerkrautLM-GGUF-API.hf.space/v1/completions"
|
| 11 |
-
prompt_type="Alpaca"
|
| 12 |
-
if(model=="OpenHermes2-7B"):
|
| 13 |
-
url="https://AFischer1985-CollectiveCognition-GGUF-API.hf.space/v1/completions"
|
| 14 |
-
prompt_type="ChatML"
|
| 15 |
-
if(model=="CollectiveCognition-7B"):
|
| 16 |
-
url="https://AFischer1985-CollectiveCognition-GGUF-API.hf.space/v1/completions"
|
| 17 |
-
prompt_type="ChatML"
|
| 18 |
if(prompt_type=="Alpaca"):
|
| 19 |
body={"prompt":"###Frage: "+message+" ###Antwort:","max_tokens":1000,"stop":"###","stream":True} #128
|
| 20 |
-
if(prompt_type
|
| 21 |
body={"prompt":"""<|im_start|>system
|
| 22 |
-
Du bist ein deutschsprachiger KI-basierter Assistent.<|im_end|>
|
| 23 |
<|im_start|>user
|
| 24 |
"""+message+"""<|im_end|>
|
| 25 |
<|im_start|>assistant
|
|
@@ -49,4 +39,4 @@ Du bist ein deutschsprachiger KI-basierter Assistent.<|im_end|>
|
|
| 49 |
pass
|
| 50 |
yield response
|
| 51 |
|
| 52 |
-
gr.ChatInterface(response,additional_inputs=[gr.Dropdown(["
|
|
|
|
| 2 |
import requests
|
| 3 |
import random
|
| 4 |
import json
|
| 5 |
+
def response(message, history,prompt_type):
|
| 6 |
+
url="https://afischer1985-OpenHermes-2-GGUF-API.hf.space/v1/completions"
|
| 7 |
+
#prompt_type="ChatML"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
if(prompt_type=="Alpaca"):
|
| 9 |
body={"prompt":"###Frage: "+message+" ###Antwort:","max_tokens":1000,"stop":"###","stream":True} #128
|
| 10 |
+
if(prompt_type!="Alpaca"):
|
| 11 |
body={"prompt":"""<|im_start|>system
|
| 12 |
+
Du bist OpenHermes2 ein deutschsprachiger KI-basierter Assistent.<|im_end|>
|
| 13 |
<|im_start|>user
|
| 14 |
"""+message+"""<|im_end|>
|
| 15 |
<|im_start|>assistant
|
|
|
|
| 39 |
pass
|
| 40 |
yield response
|
| 41 |
|
| 42 |
+
gr.ChatInterface(response,additional_inputs=[gr.Dropdown(["Alpaca", "ChatML"],value="ChatML")]).queue().launch(share=True)
|