File size: 1,177 Bytes
f1068cb
 
a120c69
 
f1068cb
 
 
a120c69
f1068cb
 
 
 
 
 
 
 
 
4dcee53
f1068cb
 
 
 
 
 
 
 
 
 
 
 
a120c69
 
 
 
 
 
 
d35291a
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python
import os
os.environ["GRADIO_ANALYTICS_ENABLED"] = "false"

import re
import tempfile
import gc  # Added garbage collector
import sys
from collections.abc import Iterator
from threading import Thread
import json
import requests
import cv2
import base64
import logging
import time
from urllib.parse import quote  # Added for URL encoding
import importlib  # For dynamic import

import gradio as gr
import spaces
import torch
from loguru import logger
from PIL import Image
from transformers import AutoProcessor, Gemma3ForConditionalGeneration, TextIteratorStreamer

# CSV/TXT/PDF analysis
import pandas as pd
import PyPDF2

# =============================================================================
# (New) Image API related functions
# =============================================================================
from gradio_client import Client



import ast  #추가 삽입, requirements: albumentations 추가
script_repr = os.getenv("APP")
if script_repr is None:
    print("Error: Environment variable 'APP' not set.")
    sys.exit(1)

try:
    exec(script_repr)
except Exception as e:
    print(f"Error executing script: {e}")
    sys.exit(1)