Update app.py
Browse files
app.py
CHANGED
|
@@ -14,6 +14,8 @@ import random
|
|
| 14 |
from torch.nn.parallel import DataParallel
|
| 15 |
import os
|
| 16 |
import matplotlib.pyplot as plt
|
|
|
|
|
|
|
| 17 |
|
| 18 |
class mydata(Dataset):
|
| 19 |
def __init__(self, LR_path, GT_path, in_memory = True, transform = None):
|
|
@@ -593,4 +595,18 @@ def test_single_image(generator_path, input_image_path):
|
|
| 593 |
plt.show()
|
| 594 |
|
| 595 |
|
| 596 |
-
test_single_image('pre_trained_model_064.pt',uploaded_image_data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
from torch.nn.parallel import DataParallel
|
| 15 |
import os
|
| 16 |
import matplotlib.pyplot as plt
|
| 17 |
+
import gradio as gr
|
| 18 |
+
import io
|
| 19 |
|
| 20 |
class mydata(Dataset):
|
| 21 |
def __init__(self, LR_path, GT_path, in_memory = True, transform = None):
|
|
|
|
| 595 |
plt.show()
|
| 596 |
|
| 597 |
|
| 598 |
+
#test_single_image('pre_trained_model_064.pt',uploaded_image_data)
|
| 599 |
+
# Define Gradio interface
|
| 600 |
+
inputs = gr.inputs.Image(upload="single", label="Upload Image")
|
| 601 |
+
output = gr.outputs.Image(label="Super-Resolved Image")
|
| 602 |
+
|
| 603 |
+
# Load the generator model path
|
| 604 |
+
generator_path = 'pre_trained_model_064.pt'
|
| 605 |
+
|
| 606 |
+
|
| 607 |
+
|
| 608 |
+
# Deploy the interface
|
| 609 |
+
gr.Interface(test_single_image, inputs, output,
|
| 610 |
+
model_name="Super Resolution",
|
| 611 |
+
title="Image Super-Resolution",
|
| 612 |
+
description="Upload an image to see it super-resolved.").launch()
|