Satyam-Singh commited on
Commit
68fb1bb
·
verified ·
1 Parent(s): edc02e2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +65 -42
app.py CHANGED
@@ -5,6 +5,7 @@ from huggingface_hub import InferenceClient
5
 
6
  client = InferenceClient("Satyam-Singh/LLaVa-Large-Language-Virtual-Assistant")
7
 
 
8
 
9
  # Set up the model
10
  generation_config = {
@@ -103,53 +104,76 @@ def gemini_chat(message, history):
103
  response = convo.send_message(message)
104
  return response.text
105
 
106
- additional_inputs=[
107
- gr.Slider(
108
- label="Temperature",
109
- value=0.9,
110
- minimum=0.0,
111
- maximum=1.0,
112
- step=0.05,
113
- interactive=True,
114
- info="Higher values produce more diverse outputs",
115
- ),
116
- gr.Slider(
117
- label="Max new tokens",
118
- value=4096,
119
- minimum=0,
120
- maximum=8192,
121
- step=64,
122
- interactive=True,
123
- info="The maximum numbers of new tokens",
124
- ),
125
- gr.Slider(
126
- label="Top-p (nucleus sampling)",
127
- value=1,
128
- minimum=0.0,
129
- maximum=1,
130
- step=0.05,
131
- interactive=True,
132
- info="Higher values sample more low-probability tokens",
133
- ),
134
- gr.Slider(
135
- label="Repetition penalty",
136
- value=1,
137
- minimum=1.0,
138
- maximum=2.0,
139
- step=0.05,
140
- interactive=True,
141
- info="Penalize repeated tokens",
142
- )
143
- ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
 
145
- examples=[["I'm planning a vacation to Japan. Can you suggest a one-week itinerary including must-visit places and local cuisines to try?", None, None, None, None, None, ],
146
  ["Can you write a short story about a time-traveling detective who solves historical mysteries?", None, None, None, None, None,],
147
  ["I'm trying to learn French. Can you provide some common phrases that would be useful for a beginner, along with their pronunciations?", None, None, None, None, None,],
148
- ["I have chicken, rice, and bell peppers in my kitchen. Can you suggest an easy recipe I can make with these ingredients?", None, None, None, None, None,],
149
  ["Can you explain how the QuickSort algorithm works and provide a Python implementation?", None, None, None, None, None,],
150
- ["What are some unique features of Rust that make it stand out compared to other systems programming languages like C++?", None, None, None, None, None,],
151
  ]
152
 
 
 
153
  gr.ChatInterface(
154
  fn=gemini_chat,
155
  chatbot=gr.Chatbot(show_label=False,
@@ -162,7 +186,6 @@ gr.ChatInterface(
162
  ),
163
  title="LLAVA: Large Language Virtual Assistant",
164
  description="Official Demo Of ```LLAVA``` based on ```Large Language Virtual Assistant ```.",
165
- additional_inputs=additional_inputs,#title="LLaVa 56B Large Language Virtual Assiatant",
166
  examples=examples,
167
  concurrency_limit=20,
168
  ).launch(show_api=True)
 
5
 
6
  client = InferenceClient("Satyam-Singh/LLaVa-Large-Language-Virtual-Assistant")
7
 
8
+ TITLE = """<h1 align="center">LLaVa Large Language Virtual Assistant</h1>"""
9
 
10
  # Set up the model
11
  generation_config = {
 
104
  response = convo.send_message(message)
105
  return response.text
106
 
107
+ run_button_component = gr.Button(value="Run", variant="primary", scale=1)
108
+ temperature_component = gr.Slider(
109
+ minimum=0,
110
+ maximum=1.0,
111
+ value=0.4,
112
+ step=0.05,
113
+ label="Temperature",
114
+ info=(
115
+ "Temperature controls the degree of randomness in token selection. Lower "
116
+ "temperatures are good for prompts that expect a true or correct response, "
117
+ "while higher temperatures can lead to more diverse or unexpected results. "
118
+ ))
119
+ max_output_tokens_component = gr.Slider(
120
+ minimum=1,
121
+ maximum=2048,
122
+ value=1024,
123
+ step=1,
124
+ label="Token limit",
125
+ info=(
126
+ "Token limit determines the maximum amount of text output from one prompt. A "
127
+ "token is approximately four characters. The default value is 2048."
128
+ ))
129
+ stop_sequences_component = gr.Textbox(
130
+ label="Add stop sequence",
131
+ value="",
132
+ type="text",
133
+ placeholder="STOP, END",
134
+ info=(
135
+ "A stop sequence is a series of characters (including spaces) that stops "
136
+ "response generation if the model encounters it. The sequence is not included "
137
+ "as part of the response. You can add up to five stop sequences."
138
+ ))
139
+ top_k_component = gr.Slider(
140
+ minimum=1,
141
+ maximum=40,
142
+ value=32,
143
+ step=1,
144
+ label="Top-K",
145
+ info=(
146
+ "Top-k changes how the model selects tokens for output. A top-k of 1 means the "
147
+ "selected token is the most probable among all tokens in the model’s "
148
+ "vocabulary (also called greedy decoding), while a top-k of 3 means that the "
149
+ "next token is selected from among the 3 most probable tokens (using "
150
+ "temperature)."
151
+ ))
152
+ top_p_component = gr.Slider(
153
+ minimum=0,
154
+ maximum=1,
155
+ value=1,
156
+ step=0.01,
157
+ label="Top-P",
158
+ info=(
159
+ "Top-p changes how the model selects tokens for output. Tokens are selected "
160
+ "from most probable to least until the sum of their probabilities equals the "
161
+ "top-p value. For example, if tokens A, B, and C have a probability of .3, .2, "
162
+ "and .1 and the top-p value is .5, then the model will select either A or B as "
163
+ "the next token (using temperature). "
164
+ ))
165
+
166
 
167
+ examples=[["I'm planning a vacation to India. Can you suggest a one-week itinerary including must-visit places and local cuisines to try?", None, None, None, None, None, ],
168
  ["Can you write a short story about a time-traveling detective who solves historical mysteries?", None, None, None, None, None,],
169
  ["I'm trying to learn French. Can you provide some common phrases that would be useful for a beginner, along with their pronunciations?", None, None, None, None, None,],
170
+ ["I have paneer, rice, and bell peppers in my kitchen. Can you suggest an easy recipe I can make with these ingredients?", None, None, None, None, None,],
171
  ["Can you explain how the QuickSort algorithm works and provide a Python implementation?", None, None, None, None, None,],
172
+ ["What are some unique features of Python that make it stand out compared to other systems programming languages like C++,Java?", None, None, None, None, None,],
173
  ]
174
 
175
+ gr.HTML(TITLE)
176
+
177
  gr.ChatInterface(
178
  fn=gemini_chat,
179
  chatbot=gr.Chatbot(show_label=False,
 
186
  ),
187
  title="LLAVA: Large Language Virtual Assistant",
188
  description="Official Demo Of ```LLAVA``` based on ```Large Language Virtual Assistant ```.",
 
189
  examples=examples,
190
  concurrency_limit=20,
191
  ).launch(show_api=True)