Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from gradio_client import Client
|
3 |
+
|
4 |
+
# Initialize the Gradio client
|
5 |
+
client = Client("https://tonic1-mistralmed-chat.hf.space/--replicas/crzkn/")
|
6 |
+
|
7 |
+
def predict(user_input):
|
8 |
+
system_prompt = "You are MistralMed Created By Tonic-AI. You are a Very Helpful Assistant. You always provide a cautious answer, check your work, provide a long detailed answer."
|
9 |
+
|
10 |
+
result = client.predict(
|
11 |
+
user_input,
|
12 |
+
system_prompt,
|
13 |
+
api_name="/mistralmed"
|
14 |
+
)
|
15 |
+
|
16 |
+
# Return the result from the API
|
17 |
+
return result
|
18 |
+
|
19 |
+
# Define the Gradio interface with a title and description
|
20 |
+
iface = gr.Interface(
|
21 |
+
fn=predict,
|
22 |
+
inputs=gr.inputs.Textbox(label="User Input"),
|
23 |
+
outputs=gr.outputs.Textbox(label="Result"),
|
24 |
+
title="👋🏻👋🏻Welcome to MistralMed_EasyChat",
|
25 |
+
description="This app makes it easy for use [Tonic/mistralmed](Tonic/mistralmed) and also to make a discordbot. Join us on our active [builder's server on discord](https://discord.gg/9XK7zXR7Ke) ."
|
26 |
+
)
|
27 |
+
|
28 |
+
iface.launch()
|