hanzla commited on
Commit
09e1b8b
β€’
1 Parent(s): 2b6b154
Files changed (1) hide show
  1. app.py +18 -6
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 greet(n):
10
- print(zero.device) # <-- 'cuda:0' πŸ€—
11
- return f"Hello {zero + n} Tensor"
 
 
12
 
13
- gr.Interface(fn=greet, inputs=gr.Number(), outputs=gr.Text()).launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
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()