awacke1's picture
Create app.py
579471f verified
raw
history blame
4.45 kB
import streamlit as st
AppGoals="""
Computer Use
1. Browser based testing app
2. similar to apps I wrote years ago which would operate a browser then run tests against my web apps including being able to compare any image or text content together to search results from one of my ai programs to determine content overlap which is then used to evaluate the results and update my ai model context data to store anything that was found that adds to the original idea. When I looked at this problem before I found chrome driver for automatic testing, saucelabs which can kind of do it, and then some python testing libraries which could do it. Can you enlighten me on which python libraries and potenitally dev tools which would help me with this to automate my testing and evaluation of my ai generated content which resides at many different URLs on huggingface as running apps
3. Past apps per wayback from 2004:
- https://web.archive.org/web/20040520102150/http://www.evolvable.com/EStore/
WebTest 8.0
WebTest is a stress and load testing browser.
You can use WebTest to identify defects that occur when web sites incurr a large amount of traffic.
To use WebTest, simply visit the pages that you want to test and WebTest remembers your navigation history. You can save the history to a text file that you can open from other machines or other copies of WebTest running on your computer. To perform stress testing, set the time interval you would like WebTest to visit each Url, then set the cycle option to cycle through your site list.
Features Include:
Screen Captures
Graph of Page Load Times
Memory of Visited Pages
Tunable Delay and Maximum Wait Time
Hotkeys for Typical Browser Resolution Sizing
XML/XSL based Usability Reporting
Crawler 1.0
Have you ever wanted to analyze a web site to see what it contains yet didn't want to spend the next few days traversing all the links on the site?
With Crawler, you can enter a web address and Crawler visits every page, extracting a reusable list of links from the pages it reviews.
You can save the HTML source code from each page that Crawler encounters so you can analyze the site further, or automatically surf the site and take snapshots using Evolvable WebTest.
Crawler is an indespensable tool because it provides results in an easy to use format and also allows you to search for terms across different sites and save the list of links that match your search criteria.
Let me help you explore the Python libraries and tools that would be well-suited for automated browser testing and content comparison for AI-generated content.
The most popular and robust options for this type of testing are:
Selenium with Python
pythonCopyfrom selenium import webdriver
from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
driver.get("https://huggingface.co/your-app")
content = driver.find_element(By.CLASS_NAME, "content").text
Playwright (more modern alternative to Selenium)
pythonCopyfrom playwright.sync_api import sync_playwright
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page()
page.goto("https://huggingface.co/your-app")
content = page.inner_text(".content")
For content comparison and similarity analysis:
pythonCopyfrom difflib import SequenceMatcher
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity
# Basic text similarity
def similarity_ratio(text1, text2):
return SequenceMatcher(None, text1, text2).ratio()
# More advanced semantic similarity
def semantic_similarity(text1, text2):
vectorizer = TfidfVectorizer()
tfidf = vectorizer.fit_transform([text1, text2])
return cosine_similarity(tfidf[0:1], tfidf[1:2])[0][0]
For image comparison:
pythonCopyfrom PIL import Image
import imagehash
import numpy as np
def compare_images(image1_path, image2_path):
hash1 = imagehash.average_hash(Image.open(image1_path))
hash2 = imagehash.average_hash(Image.open(image2_path))
return hash1 - hash2 # Lower number means more similar
Would you like me to create a more comprehensive example that combines these elements into a complete testing framework? I could show you how to:
Automate browsing multiple HuggingFace URLs
Extract both text and image content
Compare content using different similarity metrics
Store results in a structured format for model context updates
"""
st.markdown(Goals)