Spaces:
Sleeping
Sleeping
Commit
·
1c75036
1
Parent(s):
814ab96
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,23 @@ import gradio as gr
|
|
3 |
|
4 |
client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
def format_prompt(message, history):
|
7 |
prompt = "<s>"
|
8 |
for user_prompt, bot_response in history:
|
|
|
3 |
|
4 |
client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
|
5 |
|
6 |
+
def my_inference_function(name):
|
7 |
+
return "Hello " + name + "!"
|
8 |
+
|
9 |
+
gradio_interface = gradio.Interface(
|
10 |
+
fn=my_inference_function,
|
11 |
+
inputs="text",
|
12 |
+
outputs="text",
|
13 |
+
examples=[
|
14 |
+
["Jill"],
|
15 |
+
["Sam"]
|
16 |
+
],
|
17 |
+
title="REST API with Gradio and Huggingface Spaces",
|
18 |
+
description="This is a demo of how to build an AI powered REST API with Gradio and Huggingface Spaces – for free! Based on [this article](https://www.tomsoderlund.com/ai/building-ai-powered-rest-api). See the **Use via API** link at the bottom of this page.",
|
19 |
+
article="© Tom Söderlund 2022"
|
20 |
+
)
|
21 |
+
gradio_interface.launch()
|
22 |
+
|
23 |
def format_prompt(message, history):
|
24 |
prompt = "<s>"
|
25 |
for user_prompt, bot_response in history:
|