first
Browse files
app.py
CHANGED
@@ -2,12 +2,24 @@ import gradio as gr
|
|
2 |
import spaces
|
3 |
import torch
|
4 |
|
5 |
-
zero = torch.Tensor([0]).cuda()
|
6 |
-
print(zero.device) # <-- 'cpu' π€
|
7 |
|
8 |
@spaces.GPU
|
9 |
-
def
|
10 |
-
|
11 |
-
|
|
|
|
|
12 |
|
13 |
-
gr.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
import spaces
|
3 |
import torch
|
4 |
|
|
|
|
|
5 |
|
6 |
@spaces.GPU
|
7 |
+
def yes_man(message, history):
|
8 |
+
if message.endswith("?"):
|
9 |
+
return "Yes"
|
10 |
+
else:
|
11 |
+
return "Ask me anything!"
|
12 |
|
13 |
+
gr.ChatInterface(
|
14 |
+
yes_man,
|
15 |
+
chatbot=gr.Chatbot(height=300),
|
16 |
+
textbox=gr.Textbox(placeholder="Ask me a yes or no question", container=False, scale=7),
|
17 |
+
title="Yes Man",
|
18 |
+
description="Ask Yes Man any question",
|
19 |
+
theme="soft",
|
20 |
+
examples=["Hello", "Am I cool?", "Are tomatoes vegetables?"],
|
21 |
+
cache_examples=True,
|
22 |
+
retry_btn=None,
|
23 |
+
undo_btn="Delete Previous",
|
24 |
+
clear_btn="Clear",
|
25 |
+
).launch()
|