Spaces:
Running
on
Zero
Running
on
Zero
zR
commited on
Commit
•
d42a4df
1
Parent(s):
ad14d34
use
Browse files
README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
---
|
2 |
-
title: GLM-Edge-
|
3 |
-
emoji:
|
4 |
colorFrom: green
|
5 |
colorTo: indigo
|
6 |
sdk: gradio
|
@@ -9,9 +9,9 @@ app_file: app.py
|
|
9 |
pinned: false
|
10 |
---
|
11 |
|
12 |
-
## GLM-Edge-
|
13 |
|
14 |
-
Run with Gradio on GLM-Edge-
|
15 |
```shell
|
16 |
python app.py
|
17 |
```
|
|
|
1 |
---
|
2 |
+
title: GLM-Edge-V-5B Space
|
3 |
+
emoji: 📷
|
4 |
colorFrom: green
|
5 |
colorTo: indigo
|
6 |
sdk: gradio
|
|
|
9 |
pinned: false
|
10 |
---
|
11 |
|
12 |
+
## GLM-Edge-V-5B Space
|
13 |
|
14 |
+
Run with Gradio on GLM-Edge-V-5B Space.
|
15 |
```shell
|
16 |
python app.py
|
17 |
```
|
app.py
CHANGED
@@ -5,6 +5,7 @@ from PIL import Image
|
|
5 |
import re
|
6 |
import gradio as gr
|
7 |
import torch
|
|
|
8 |
from transformers import (
|
9 |
AutoTokenizer,
|
10 |
AutoModelForCausalLM,
|
@@ -51,6 +52,7 @@ def preprocess_messages(history, image):
|
|
51 |
print("Invalid image path. Continuing with text conversation.")
|
52 |
return messages, pixel_values
|
53 |
|
|
|
54 |
def predict(history, max_length, top_p, temperature, image=None):
|
55 |
messages, pixel_values = preprocess_messages(history, image)
|
56 |
|
|
|
5 |
import re
|
6 |
import gradio as gr
|
7 |
import torch
|
8 |
+
import spaces
|
9 |
from transformers import (
|
10 |
AutoTokenizer,
|
11 |
AutoModelForCausalLM,
|
|
|
52 |
print("Invalid image path. Continuing with text conversation.")
|
53 |
return messages, pixel_values
|
54 |
|
55 |
+
@spaces.GPU()
|
56 |
def predict(history, max_length, top_p, temperature, image=None):
|
57 |
messages, pixel_values = preprocess_messages(history, image)
|
58 |
|