Files changed (1) hide show
  1. app.py +26 -1
app.py CHANGED
@@ -1,3 +1,28 @@
1
  import gradio as gr
2
 
3
- gr.Interface.load("models/AIDC-ai-business/Marcoroni-70B-v1").launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
+ # Define the function that will use the HuggingFace Spaces model
4
+ def chat_with_marcoroni(user_message):
5
+ # Use the loaded model to generate a response
6
+ response = gr.Interface.load("models/AIDC-ai-business/Marcoroni-70B-v1").process([user_message])
7
+
8
+ # Extract and return the response from the model's output
9
+ return response[0]
10
+
11
+ # Create a Gradio interface for the chat
12
+ iface = gr.Interface(
13
+ fn=chat_with_marcoroni,
14
+ inputs=gr.Textbox("User Message", default="Hello, Marcoroni!"),
15
+ outputs=gr.Textbox("Marcoroni's Response", readonly=True),
16
+ live=True,
17
+ theme="sketch", # Use a more visually appealing theme
18
+ title="Chat with Marcoroni-70B AI",
19
+ description="Chat with Marcoroni-70B AI. Enter your message and get a response.",
20
+ examples=[
21
+ ["Tell me a joke."],
22
+ ["Translate 'hello' to French."],
23
+ ["What's the weather like today?"],
24
+ ],
25
+ )
26
+
27
+ if __name__ == "__main__":
28
+ iface.launch()