Spaces:
Runtime error
Runtime error
access token added
Browse files
app.py
CHANGED
|
@@ -1,13 +1,15 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import InferenceClient
|
|
|
|
| 3 |
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
"""
|
| 7 |
-
|
| 8 |
-
client = InferenceClient("mistralai/Mistral-7B-Instruct-v0.3")
|
| 9 |
-
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
|
| 12 |
def respond(
|
| 13 |
message,
|
|
@@ -41,10 +43,6 @@ def respond(
|
|
| 41 |
response += token
|
| 42 |
yield response
|
| 43 |
|
| 44 |
-
|
| 45 |
-
"""
|
| 46 |
-
For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
|
| 47 |
-
"""
|
| 48 |
demo = gr.ChatInterface(
|
| 49 |
respond,
|
| 50 |
additional_inputs=[
|
|
@@ -61,6 +59,5 @@ demo = gr.ChatInterface(
|
|
| 61 |
],
|
| 62 |
)
|
| 63 |
|
| 64 |
-
|
| 65 |
if __name__ == "__main__":
|
| 66 |
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import InferenceClient
|
| 3 |
+
import os
|
| 4 |
|
| 5 |
+
# Token aus Umgebungsvariable lesen
|
| 6 |
+
HF_TOKEN = os.getenv("tomoni-access")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
+
# Client mit Token initialisieren
|
| 9 |
+
client = InferenceClient(
|
| 10 |
+
model="mistralai/Mistral-7B-Instruct-v0.3",
|
| 11 |
+
token=HF_TOKEN
|
| 12 |
+
)
|
| 13 |
|
| 14 |
def respond(
|
| 15 |
message,
|
|
|
|
| 43 |
response += token
|
| 44 |
yield response
|
| 45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
demo = gr.ChatInterface(
|
| 47 |
respond,
|
| 48 |
additional_inputs=[
|
|
|
|
| 59 |
],
|
| 60 |
)
|
| 61 |
|
|
|
|
| 62 |
if __name__ == "__main__":
|
| 63 |
demo.launch()
|