Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import spaces
|
| 2 |
import gradio as gr
|
| 3 |
from huggingface_hub import InferenceClient
|
| 4 |
from torch import nn
|
|
@@ -16,7 +16,7 @@ MODEL_PATH = "meta-llama/Meta-Llama-3.1-8B"
|
|
| 16 |
CHECKPOINT_PATH = Path("wpkklhc6")
|
| 17 |
TITLE = "<h1><center>JoyCaption Pre-Alpha (2024-07-30a)</center></h1>"
|
| 18 |
|
| 19 |
-
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
| 20 |
|
| 21 |
|
| 22 |
class ImageAdapter(nn.Module):
|
|
@@ -61,7 +61,7 @@ image_adapter.eval()
|
|
| 61 |
image_adapter.to("cuda")
|
| 62 |
|
| 63 |
|
| 64 |
-
|
| 65 |
@torch.no_grad()
|
| 66 |
def stream_chat(input_image: Image.Image):
|
| 67 |
torch.cuda.empty_cache()
|
|
@@ -126,4 +126,4 @@ with gr.Blocks() as demo:
|
|
| 126 |
|
| 127 |
|
| 128 |
if __name__ == "__main__":
|
| 129 |
-
demo.launch()
|
|
|
|
| 1 |
+
#import spaces
|
| 2 |
import gradio as gr
|
| 3 |
from huggingface_hub import InferenceClient
|
| 4 |
from torch import nn
|
|
|
|
| 16 |
CHECKPOINT_PATH = Path("wpkklhc6")
|
| 17 |
TITLE = "<h1><center>JoyCaption Pre-Alpha (2024-07-30a)</center></h1>"
|
| 18 |
|
| 19 |
+
#HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
| 20 |
|
| 21 |
|
| 22 |
class ImageAdapter(nn.Module):
|
|
|
|
| 61 |
image_adapter.to("cuda")
|
| 62 |
|
| 63 |
|
| 64 |
+
#@spaces.GPU()
|
| 65 |
@torch.no_grad()
|
| 66 |
def stream_chat(input_image: Image.Image):
|
| 67 |
torch.cuda.empty_cache()
|
|
|
|
| 126 |
|
| 127 |
|
| 128 |
if __name__ == "__main__":
|
| 129 |
+
demo.launch(share = True)
|