Philippe Kaplan commited on
Commit
5b9bb60
·
1 Parent(s): 1a7e5d6

revert + enable api

Browse files
Files changed (1) hide show
  1. app.py +1 -18
app.py CHANGED
@@ -1,7 +1,4 @@
1
  from huggingface_hub import InferenceClient
2
- from fastapi import FastAPI
3
- from pydantic import BaseModel
4
-
5
 
6
  import gradio as gr
7
 
@@ -91,20 +88,6 @@ additional_inputs=[
91
  )
92
  ]
93
 
94
- class Item(BaseModel):
95
- prompt: str
96
- history: list
97
- system_prompt: str
98
- temperature: float = 0.0
99
- max_new_tokens: int = 1048
100
- top_p: float = 0.15
101
- repetition_penalty: float = 1.0
102
- app = FastAPI()
103
-
104
- @app.post("/generate/")
105
- async def generate_text(item: Item):
106
- return {"response": generate(item.prompt, item.history, item.system_message, item.temperature, item.max_new_tokens, item.top_p, item.repetition_penalty)}
107
-
108
 
109
 
110
  gr.ChatInterface(
@@ -112,4 +95,4 @@ gr.ChatInterface(
112
  chatbot=gr.Chatbot(show_label=False, show_share_button=False, show_copy_button=True, likeable=True, layout="panel"),
113
  additional_inputs=additional_inputs,
114
  title="""mistralai/Mistral-7B-Instruct-v0.3"""
115
- ).launch(show_api=False)
 
1
  from huggingface_hub import InferenceClient
 
 
 
2
 
3
  import gradio as gr
4
 
 
88
  )
89
  ]
90
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
91
 
92
 
93
  gr.ChatInterface(
 
95
  chatbot=gr.Chatbot(show_label=False, show_share_button=False, show_copy_button=True, likeable=True, layout="panel"),
96
  additional_inputs=additional_inputs,
97
  title="""mistralai/Mistral-7B-Instruct-v0.3"""
98
+ ).launch(show_api=True)