mgbam commited on
Commit
afada0a
·
verified ·
1 Parent(s): 3e19edc

Create constants.py

Browse files
Files changed (1) hide show
  1. constants.py +56 -0
constants.py ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import re
3
+ from http import HTTPStatus
4
+ from typing import Dict, List, Optional, Tuple
5
+ import base64
6
+ import mimetypes
7
+ import PyPDF2
8
+ import docx
9
+ import cv2
10
+ import numpy as np
11
+ from PIL import Image
12
+ import pytesseract
13
+ import requests
14
+ from urllib.parse import urlparse, urljoin
15
+ from bs4 import BeautifulSoup
16
+ import html2text
17
+ import json
18
+ import time
19
+ import webbrowser
20
+ import urllib.parse
21
+
22
+ import gradio as gr
23
+
24
+ # Gradio supported languages for syntax highlighting
25
+ GRADIO_SUPPORTED_LANGUAGES = [
26
+ "python", "c", "cpp", "markdown", "latex", "json", "html", "css", "javascript", "jinja2", "typescript", "yaml", "dockerfile", "shell", "r", "sql", "sql-msSQL", "sql-mySQL", "sql-mariaDB", "sql-sqlite", "sql-cassandra", "sql-plSQL", "sql-hive", "sql-pgSQL", "sql-gql", "sql-gpSQL", "sql-sparkSQL", "sql-esper", None
27
+ ]
28
+
29
+ def get_gradio_language(language):
30
+ return language if language in GRADIO_SUPPORTED_LANGUAGES else None
31
+
32
+ # Search/Replace Constants
33
+ SEARCH_START = "<<<<<<< SEARCH"
34
+ DIVIDER = "======="
35
+ REPLACE_END = ">>>>>>> REPLACE"
36
+
37
+ # Configuration
38
+ HTML_SYSTEM_PROMPT = """ONLY USE HTML, CSS AND JAVASCRIPT. If you want to use ICON make sure to import the library first. Try to create the best UI possible by using only HTML, CSS and JAVASCRIPT. MAKE IT RESPONSIVE USING MODERN CSS. Use as much as you can modern CSS for the styling, if you can't do something with modern CSS, then use custom CSS. Also, try to elaborate as much as you can, to create something unique. ALWAYS GIVE THE RESPONSE INTO A SINGLE HTML FILE
39
+ For website redesign tasks:
40
+ - Use the provided original HTML code as the starting point for redesign
41
+ - Preserve all original content, structure, and functionality
42
+ - Keep the same semantic HTML structure but enhance the styling
43
+ - Reuse all original images and their URLs from the HTML code
44
+ - Create a modern, responsive design with improved typography and spacing
45
+ - Use modern CSS frameworks and design patterns
46
+ - Ensure accessibility and mobile responsiveness
47
+ - Maintain the same navigation and user flow
48
+ - Enhance the visual design while keeping the original layout structure
49
+ If an image is provided, analyze it and use the visual information to better understand the user's requirements.
50
+ Always respond with code that can be executed or rendered directly.
51
+ Always output only the HTML code inside a ```html ... ``` code block, and do not include any explanations or extra text. Do NOT add the language name at the top of the code output."""
52
+
53
+ TRANSFORMERS_JS_SYSTEM_PROMPT = """You are an expert web developer creating a transformers.js application. You will generate THREE separate files: index.html, index.js, and style.css.
54
+ IMPORTANT: You MUST output ALL THREE files in the following format:
55
+ ```html
56
+ <!-- index.html content here -->