Spaces:
Running
Running
Delete app.py
Browse files
app.py
DELETED
@@ -1,22 +0,0 @@
|
|
1 |
-
import torch
|
2 |
-
import gradio as gr
|
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(
|
16 |
-
fn=process_text, # Function to process input
|
17 |
-
inputs=gr.Textbox(label="Enter text"), # Input component
|
18 |
-
outputs=gr.Textbox(label="Output") # Output component
|
19 |
-
)
|
20 |
-
|
21 |
-
# Launch the Gradio app
|
22 |
-
interface.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|