gopig5 commited on
Commit
6425abe
·
verified ·
1 Parent(s): ade3393
Files changed (1) hide show
  1. app.py +27 -25
app.py CHANGED
@@ -1,6 +1,9 @@
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
 
 
 
 
4
  """
5
  For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
6
  """
@@ -39,30 +42,6 @@ def respond(
39
  response += token
40
  yield response
41
 
42
- """
43
- For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
44
- """
45
- demo = gr.ChatInterface(
46
- respond,
47
- additional_inputs=[
48
- gr.Textbox(value=prompt, label="System message"),
49
- gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
50
- gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
51
- gr.Slider(
52
- minimum=0.1,
53
- maximum=1.0,
54
- value=0.95,
55
- step=0.05,
56
- label="Top-p (nucleus sampling)",
57
- ),
58
- ],
59
- )
60
-
61
-
62
- if __name__ == "__main__":
63
- demo.launch()
64
-
65
-
66
  prompt = """<|begin_of_text|><|start_header_id|>user<|end_header_id|>
67
 
68
  Generate a SQL query to answer this question: `{user_question}`
@@ -111,4 +90,27 @@ CREATE TABLE "dashboard_ana_sayfa" (
111
  )<|eot_id|><|start_header_id|>assistant<|end_header_id|>
112
 
113
  The following SQL query best answers the question `{user_question}`:
114
- ```sql"""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
 
4
+
5
+
6
+
7
  """
8
  For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
9
  """
 
42
  response += token
43
  yield response
44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  prompt = """<|begin_of_text|><|start_header_id|>user<|end_header_id|>
46
 
47
  Generate a SQL query to answer this question: `{user_question}`
 
90
  )<|eot_id|><|start_header_id|>assistant<|end_header_id|>
91
 
92
  The following SQL query best answers the question `{user_question}`:
93
+ ```sql"""
94
+
95
+ """
96
+ For information on how to customize the ChatInterface, peruse the gradio docs: https://www.gradio.app/docs/chatinterface
97
+ """
98
+ demo = gr.ChatInterface(
99
+ respond,
100
+ additional_inputs=[
101
+ gr.Textbox(value=prompt, label="System message"),
102
+ gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
103
+ gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
104
+ gr.Slider(
105
+ minimum=0.1,
106
+ maximum=1.0,
107
+ value=0.95,
108
+ step=0.05,
109
+ label="Top-p (nucleus sampling)",
110
+ ),
111
+ ],
112
+ )
113
+
114
+
115
+ if __name__ == "__main__":
116
+ demo.launch()