Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import google.generativeai as genai
|
3 |
+
import os
|
4 |
+
token=os.environ.get("TOKEN")
|
5 |
+
|
6 |
+
genai.configure(
|
7 |
+
api_key=token
|
8 |
+
)
|
9 |
+
model = genai.GenerativeModel(
|
10 |
+
model_name='gemini-1.5-flash-latest'
|
11 |
+
)
|
12 |
+
|
13 |
+
def greet(name):
|
14 |
+
print(name)
|
15 |
+
response = model.generate_content(name)
|
16 |
+
return response.text
|
17 |
+
|
18 |
+
iface = gr.Interface(fn=greet, inputs=gr.Textbox(label="Question:", lines=4), outputs="text")
|
19 |
+
iface.launch()
|