Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import cohere
|
| 2 |
+
import gradio as gr
|
| 3 |
+
import os
|
| 4 |
+
from dotenv import load_dotenv
|
| 5 |
+
load_dotenv()
|
| 6 |
+
COHERE_API_KEY = os.getenv('COHERE_API_KEY')
|
| 7 |
+
# OPENAI_API_KEY = os.getenv('OPENAI_API_KEY')
|
| 8 |
+
co = cohere.Client(os.environ["COHERE_API_KEY"])
|
| 9 |
+
|
| 10 |
+
response = co.generate(
|
| 11 |
+
prompt='Please briefly explain to me how Deep Learning works on hardware devices using at most 100 words.',
|
| 12 |
+
max_tokens=200
|
| 13 |
+
)
|
| 14 |
+
print(response.generations[0].text)
|