|
import gradio as gr |
|
import spaces |
|
import transformers_gradio |
|
|
|
|
|
demo = gr.load(name="akhaliq/allen-test", src="spaces") |
|
|
|
|
|
olmo_demo = gr.load(name="akhaliq/olmo-anychat", src="spaces") |
|
|
|
|
|
for fn in demo.fns.values(): |
|
fn.api_name = False |
|
for fn in olmo_demo.fns.values(): |
|
fn.api_name = False |
|
|
|
|
|
with gr.Blocks() as combined_demo: |
|
model_choice = gr.Dropdown( |
|
choices=["Llama", "OLMo"], |
|
value="Llama", |
|
label="Select Model" |
|
) |
|
|
|
with gr.Tab("Model Interface"): |
|
|
|
placeholder = gr.HTML() |
|
|
|
def update_interface(choice): |
|
if choice == "Llama": |
|
return demo |
|
else: |
|
return olmo_demo |
|
|
|
model_choice.change( |
|
fn=update_interface, |
|
inputs=[model_choice], |
|
outputs=[placeholder] |
|
) |
|
|
|
|
|
|
|
|