Felguk commited on
Commit
6c68f28
·
verified ·
1 Parent(s): d81c533

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -0
app.py CHANGED
@@ -176,6 +176,25 @@ with gr.Blocks(css=css) as demo:
176
  gr.HTML("<button onclick='copyCode(\"output-text\")'>Copy Code</button>") # Add the "Copy Code" button
177
  file_output = gr.File(label="Download File", visible=False) # Hidden file download component
178
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  submit_button = gr.Button("Fetch Content")
180
  submit_button.click(
181
  fn=convert_to_text,
@@ -223,6 +242,21 @@ with gr.Blocks(css=css) as demo:
223
  with gr.Row():
224
  gr.HTML("<button onclick='copyCode(\"model-content-output\")'>Copy Code</button>") # Add the "Copy Code" button
225
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
  submit_model_button = gr.Button("Fetch Model Info and File Content")
227
  submit_model_button.click(
228
  fn=fetch_model_info,
 
176
  gr.HTML("<button onclick='copyCode(\"output-text\")'>Copy Code</button>") # Add the "Copy Code" button
177
  file_output = gr.File(label="Download File", visible=False) # Hidden file download component
178
 
179
+ # Добавляем примеры для URL to Text Converter
180
+ examples_url = [
181
+ ["https://huggingface.co"],
182
+ ["https://github.com"],
183
+ ["https://gradio.app"]
184
+ ]
185
+ gr.Examples(
186
+ examples=examples_url,
187
+ inputs=url_input,
188
+ outputs=[
189
+ results_output, text_output, file_output,
190
+ gr.Textbox(label="CSS Files"), gr.Textbox(label="JS Files"), gr.Textbox(label="Images"),
191
+ gr.Textbox(label="CSS Content"), gr.Textbox(label="JS Content")
192
+ ],
193
+ fn=convert_to_text,
194
+ cache_examples=True,
195
+ label="Примеры URL"
196
+ )
197
+
198
  submit_button = gr.Button("Fetch Content")
199
  submit_button.click(
200
  fn=convert_to_text,
 
242
  with gr.Row():
243
  gr.HTML("<button onclick='copyCode(\"model-content-output\")'>Copy Code</button>") # Add the "Copy Code" button
244
 
245
+ # Добавляем примеры для Model to Text Converter
246
+ examples_model = [
247
+ ["https://huggingface.co/microsoft/phi-2", "README.md"],
248
+ ["https://huggingface.co/openai/whisper-large-v3", "config.json"],
249
+ ["https://huggingface.co/stabilityai/stable-diffusion-2", "README.md"]
250
+ ]
251
+ gr.Examples(
252
+ examples=examples_model,
253
+ inputs=[model_url_input, file_path_input],
254
+ outputs=[model_description_output, install_instructions_output, model_content_output],
255
+ fn=lambda url, path: asyncio.run(fetch_model_info(url)) + (asyncio.run(fetch_model_file_content(url, path)),),
256
+ cache_examples=True,
257
+ label="Примеры моделей"
258
+ )
259
+
260
  submit_model_button = gr.Button("Fetch Model Info and File Content")
261
  submit_model_button.click(
262
  fn=fetch_model_info,