updated
Browse files- app.py +22 -0
- requirements.txt +4 -0
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Initialize the pipeline
|
5 |
+
pipe = pipeline("feature-extraction", model="ECOFRI/CXR-LLAVA-v2", trust_remote_code=True)
|
6 |
+
|
7 |
+
# Define a function to process inputs and return outputs
|
8 |
+
def extract_features(text):
|
9 |
+
features = pipe(text)
|
10 |
+
return features
|
11 |
+
|
12 |
+
# Create a Gradio interface
|
13 |
+
iface = gr.Interface(
|
14 |
+
fn=extract_features,
|
15 |
+
inputs="text",
|
16 |
+
outputs="json",
|
17 |
+
title="Feature Extraction Demo",
|
18 |
+
description="Enter text to extract features using the ECOFRI/CXR-LLAVA-v2 model."
|
19 |
+
)
|
20 |
+
|
21 |
+
# Launch the interface
|
22 |
+
iface.launch()
|
requirements.txt
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
transformers
|
2 |
+
gradio
|
3 |
+
torch
|
4 |
+
einops
|