| import altair as alt |
| import numpy as np |
| import pandas as pd |
| import streamlit as st |
|
|
| |
| st.set_page_config(page_title="Image Preference Study", layout="centered") |
|
|
| st.title("Image Preference Study") |
| st.write("For each pair, please select which image you prefer.") |
|
|
| |
| |
| image_pairs = [ |
| ("images/modelA_1.png", "images/modelB_1.png"), |
| ] |
|
|
| results = {} |
|
|
| |
| for i, (imgA, imgB) in enumerate(image_pairs): |
| st.markdown(f"### Pair {i+1}") |
| col1, col2 = st.columns(2) |
|
|
| with col1: |
| st.image(imgA, caption="Option A", use_container_width=True) |
| with col2: |
| st.image(imgB, caption="Option B", use_container_width=True) |
|
|
| choice = st.radio( |
| f"Which image do you prefer for Pair {i+1}?", |
| ("A", "B"), |
| key=f"choice_{i}" |
| ) |
| results[f"pair_{i+1}"] = choice |
|
|
| |
| if st.button("Submit"): |
| st.success("Thank you! Your responses have been recorded.") |
| st.write("Here are your selections:") |
| st.json(results) |
|
|
| |
| with open("resp/responses.txt", "a") as f: |
| f.write(str(results) + "\n") |