update allen ai tab
Browse files1 unmodified line23456789101112131415161718192021222324252627282930311 unmodified lineimport spacesimport transformers_gradio# Load modelsllama_demo = gr.load(name="allenai/Llama-3.1-Tulu-3-8B", src=transformers_gradio.registry)llama_demo.fn = spaces.GPU()(llama_demo.fn)olmo_demo = gr.load(name="akhaliq/olmo-anychat", src="spaces")# Create the interfacewith gr.Blocks() as demo:model_dropdown = gr.Dropdown(choices=["allenai/Llama-3.1-Tulu-3-8B", "akhaliq/olmo-anychat"],value="allenai/Llama-3.1-Tulu-3-8B",label="Select Model")def chat(message, model_name):if model_name == "allenai/Llama-3.1-Tulu-3-8B":return llama_demo.fn(message)else:return olmo_demo.fn(message)chatinterface = gr.ChatInterface(chat, additional_inputs=[model_dropdown])# Disable API namesfor fn in demo.fns.values():fn.api_name = False1 unmodified line234567891011121314151617181920212223242526272829303132333435363738394041421 unmodified lineimport spacesimport transformers_gradio# Load Llama modeldemo = gr.load(name="akhaliq/allen-test", src="spaces")# Load OLMo modelolmo_demo = gr.load(name="akhaliq/olmo-anychat", src="spaces")# Disable API names for both demosfor fn in demo.fns.values():fn.api_name = Falsefor fn in olmo_demo.fns.values():fn.api_name = False# Create a dropdown to select the modelwith gr.Blocks() as combined_demo:model_choice = gr.Dropdown(choices=["Llama", "OLMo"],value="Llama",label="Select Model")with gr.Tab("Model Interface"):# Create placeholder for the selected model's interfaceplaceholder = gr.HTML()def update_interface(choice):if choice == "Llama":return demoelse:return olmo_demomodel_choice.change(fn=update_interface,inputs=[model_choice],outputs=[placeholder])
app_allenai.py+29-18