-
Notifications
You must be signed in to change notification settings - Fork 839
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ticket: CVS-147626 Notebooks: 1. speculative-sampling/speculative-sampling.ipynb 2. stable-audio/stable-audio.ipynb 3. surya-line-level-text-detection/surya-line-level-text-detection.ipynb - minimal Gradio demo, helper not needed 4. table-question-answering/table-question-answering.ipynb 5. tiny-sd-image-generation/tiny-sd-image-generation.ipynb 6. triposr-3d-reconstruction/triposr-3d-reconstruction.ipynb 7. typo-detector/typo-detector.ipynb - no gradio demo 8. wuerstchen-image-generation/wuerstchen-image-generation.ipynb - minimal Gradio demo, helper not needed 9. yolov10-optimization/yolov10-optimization.ipynb 10. zeroscope-text2video/zeroscope-text2video.ipynb
- Loading branch information
Showing
19 changed files
with
561 additions
and
365 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from typing import Callable | ||
import gradio as gr | ||
|
||
|
||
main_model_id = "meta-llama/Llama-2-7b-chat-hf" | ||
draft_model_id = "TinyLlama/TinyLlama-1.1B-Chat-v1.0" | ||
|
||
|
||
def make_demo(fn: Callable): | ||
with gr.Blocks() as demo: | ||
gr.Markdown( | ||
f""" | ||
# Speculative Sampling Demo | ||
## The output will show a comparison of Autoregressive Sampling vs Speculative Sampling | ||
- Main Model: {main_model_id} | ||
- Draft Model: {draft_model_id} | ||
- K = 5 | ||
""" | ||
) | ||
with gr.Row(): | ||
input = gr.Textbox( | ||
value="Alan Turing was a", | ||
placeholder="THIS CANNOT BE EMPTY", | ||
label="Input Prompt", | ||
) | ||
output = gr.Textbox(label="Output") | ||
btn = gr.Button("Run") | ||
btn.click(fn=fn, inputs=input, outputs=output) | ||
return demo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from typing import Callable | ||
import gradio as gr | ||
import numpy as np | ||
|
||
|
||
MAX_SEED = np.iinfo(np.int32).max | ||
|
||
|
||
def make_demo(fn: Callable): | ||
demo = gr.Interface( | ||
fn=fn, | ||
inputs=[ | ||
gr.Textbox(label="Text Prompt"), | ||
gr.Slider(1, 47, label="Total seconds", step=1, value=10), | ||
gr.Slider(10, 100, label="Number of steps", step=1, value=100), | ||
gr.Slider(0, MAX_SEED, label="Seed", step=1), | ||
], | ||
outputs=["audio"], | ||
examples=[ | ||
["128 BPM tech house drum loop"], | ||
["Blackbird song, summer, dusk in the forest"], | ||
["Rock beat played in a treated studio, session drumming on an acoustic kit"], | ||
["Calmful melody and nature sounds for restful sleep"], | ||
], | ||
allow_flagging="never", | ||
) | ||
return demo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
from pathlib import Path | ||
from typing import Callable | ||
import gradio as gr | ||
import pandas as pd | ||
import requests | ||
|
||
csv_file_name = "eu_city_population_top10.csv" | ||
|
||
if not Path(csv_file_name).exists(): | ||
r = requests.get("https://github.com/openvinotoolkit/openvino_notebooks/files/13215688/eu_city_population_top10.csv") | ||
with open(csv_file_name, "w") as f: | ||
f.write(r.text) | ||
|
||
|
||
def display_table(csv_file_name): | ||
table = pd.read_csv(csv_file_name.name, delimiter=",") | ||
table = table.astype(str) | ||
return table | ||
|
||
|
||
def make_demo(fn: Callable): | ||
with gr.Blocks(title="TAPAS Table Question Answering") as demo: | ||
with gr.Row(): | ||
with gr.Column(): | ||
search_query = gr.Textbox(label="Search query") | ||
csv_file = gr.File(label="CSV file") | ||
infer_button = gr.Button("Submit", variant="primary") | ||
with gr.Column(): | ||
answer = gr.Textbox(label="Result") | ||
result_csv_file = gr.Dataframe(label="All data") | ||
|
||
examples = [ | ||
[ | ||
"What is the city with the highest population that is not a capital?", | ||
csv_file_name, | ||
], | ||
["In which country is Madrid?", csv_file_name], | ||
[ | ||
"In which cities is the population greater than 2,000,000?", | ||
csv_file_name, | ||
], | ||
] | ||
gr.Examples(examples, inputs=[search_query, csv_file]) | ||
|
||
# Callbacks | ||
csv_file.upload(display_table, inputs=csv_file, outputs=result_csv_file) | ||
csv_file.select(display_table, inputs=csv_file, outputs=result_csv_file) | ||
csv_file.change(display_table, inputs=csv_file, outputs=result_csv_file) | ||
infer_button.click(fn=fn, inputs=[search_query, csv_file], outputs=[answer, result_csv_file]) | ||
return demo |
Oops, something went wrong.