Spaces:
Sleeping
Sleeping
Delete app.py
Browse files
app.py
DELETED
|
@@ -1,41 +0,0 @@
|
|
| 1 |
-
# -*- coding: utf-8 -*-
|
| 2 |
-
"""6.3 hugging face - gradio.ipynb
|
| 3 |
-
Automatically generated by Colab.
|
| 4 |
-
Original file is located at
|
| 5 |
-
https://colab.research.google.com/drive/1JpRdo-xi3cVH-bQtQp_mWpctxk0krUQR
|
| 6 |
-
"""
|
| 7 |
-
|
| 8 |
-
#from google.colab import userdata
|
| 9 |
-
import os
|
| 10 |
-
#https://console.groq.com/keys
|
| 11 |
-
#os.environ['GROQ_API_KEY'] = userdata.get('GROQ_API_KEY')
|
| 12 |
-
|
| 13 |
-
from groq import Groq
|
| 14 |
-
client = Groq()
|
| 15 |
-
|
| 16 |
-
import gradio as gr
|
| 17 |
-
from groq import Groq
|
| 18 |
-
|
| 19 |
-
# Define a simple function
|
| 20 |
-
def groq(text):
|
| 21 |
-
client = Groq()
|
| 22 |
-
completion = client.chat.completions.create(
|
| 23 |
-
model="llama-3.1-8b-instant",
|
| 24 |
-
messages=[
|
| 25 |
-
{
|
| 26 |
-
"role": "user",
|
| 27 |
-
"content": text
|
| 28 |
-
}
|
| 29 |
-
]
|
| 30 |
-
)
|
| 31 |
-
return(completion.choices[0].message.content)
|
| 32 |
-
|
| 33 |
-
# Create Gradio interface
|
| 34 |
-
demo = gr.Interface(
|
| 35 |
-
fn=groq, # Function to call
|
| 36 |
-
inputs=gr.Textbox(label="Enter text", lines=12), # Input component
|
| 37 |
-
outputs=gr.Textbox(label="query", lines=12) # Output component
|
| 38 |
-
)
|
| 39 |
-
|
| 40 |
-
# Launch the interface
|
| 41 |
-
demo.launch(debug=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|