electric-otter commited on
Commit
ca18b17
·
verified ·
1 Parent(s): c306582

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -6
app.py CHANGED
@@ -1,10 +1,34 @@
1
  import gradio as gr
 
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  with gr.Blocks(fill_height=True) as demo:
4
  with gr.Sidebar():
5
- gr.Markdown("# Inference Provider")
6
- gr.Markdown("This Space showcases the google/gemma-3-27b-it model, served by the nebius API. Sign in with your Hugging Face account to use this API.")
7
- button = gr.LoginButton("Sign in")
8
- gr.load("models/google/gemma-3-27b-it", accept_token=button, provider="nebius")
9
-
10
- demo.launch()
 
 
 
 
 
 
1
  import gradio as gr
2
+ import datasets
3
 
4
+ # Load NVIDIA’s Llama-Nemotron dataset (public)
5
+ dataset = datasets.load_dataset("nvidia/Llama-Nemotron-Post-Training-Dataset-v1", split="train")
6
+
7
+ # Function to find relevant info from the dataset
8
+ def search_dataset(query):
9
+ results = []
10
+ for data in dataset.shuffle(seed=42).select(range(10)): # Search 10 random samples
11
+ if query.lower() in data["text"].lower():
12
+ results.append(data["text"])
13
+ return "\n\n".join(results) if results else "No relevant data found."
14
+
15
+ # Function to generate responses
16
+ def chat(user_message):
17
+ context = search_dataset(user_message) # Get relevant dataset content
18
+ system_prompt = "You are Jellyfish AI, an advanced assistant with knowledge from NVIDIA’s dataset."
19
+ return f"{system_prompt}\nContext: {context}\nUser: {user_message}\nJellyfish AI:"
20
+
21
+ # Gradio UI
22
  with gr.Blocks(fill_height=True) as demo:
23
  with gr.Sidebar():
24
+ gr.Markdown("# Jellyfish AI 2025 1.0.0")
25
+ gr.Markdown("Powered by NVIDIA’s Llama-Nemotron dataset. No external API needed!")
26
+
27
+ gr.Markdown("### Chat with Jellyfish AI")
28
+ user_input = gr.Textbox(label="Your Message")
29
+ output = gr.Textbox(label="Jellyfish AI's Response", interactive=False)
30
+
31
+ chat_button = gr.Button("Send")
32
+ chat_button.click(chat, inputs=user_input, outputs=output)
33
+
34
+ demo.launch()