warhawkmonk commited on
Commit
b1a73d9
·
verified ·
1 Parent(s): 8dc3b9b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -1,7 +1,15 @@
1
- import gradio as gr
2
 
3
  def process_text(input_text):
4
- return input_text.upper()
 
 
 
 
 
 
 
 
5
 
6
  # Define the Gradio interface
7
  interface = gr.Interface(
 
1
+ import torch
2
 
3
  def process_text(input_text):
4
+ # Example CUDA processing: reverse the input string and move to GPU
5
+ if torch.cuda.is_available():
6
+ device = torch.device("cuda")
7
+ tensor = torch.tensor([ord(c) for c in input_text], device=device)
8
+ reversed_tensor = tensor.flip(0)
9
+ output_text = ''.join([chr(int(c)) for c in reversed_tensor.cpu()])
10
+ return output_text
11
+ else:
12
+ return "CUDA is not available."
13
 
14
  # Define the Gradio interface
15
  interface = gr.Interface(