akshaypulla commited on
Commit
39f9ab0
Β·
verified Β·
1 Parent(s): 2cf4a9f

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. check_port_8000.sh +124 -0
  2. server/app.py +41 -2
check_port_8000.sh ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ # Comprehensive port 8000 search script
3
+ # Searches all project files for port-related 8000 references
4
+
5
+ echo "=================================================="
6
+ echo " PROCURE RL - PORT 8000 COMPREHENSIVE AUDIT"
7
+ echo "=================================================="
8
+ echo ""
9
+
10
+ # Define project source files (not external libs or auto-generated)
11
+ PROJECT_FILES=(
12
+ "models.py"
13
+ "opponent.py"
14
+ "graders.py"
15
+ "client.py"
16
+ "inference.py"
17
+ "server/app.py"
18
+ "server/Procure_RL_environment.py"
19
+ "server/Dockerfile"
20
+ "server/requirements.txt"
21
+ "openenv.yaml"
22
+ "README.md"
23
+ "EXPLANATION.md"
24
+ "plan.md"
25
+ "Instructions.md"
26
+ "test_graders.py"
27
+ "test_rl_properties.py"
28
+ "test_calibration.py"
29
+ "pyproject.toml"
30
+ "__init__.py"
31
+ ".env.example"
32
+ )
33
+
34
+ echo "1. Searching for 'localhost:8000' pattern (actual port reference)..."
35
+ echo "----------------------------------------------------------------------"
36
+ FOUND_LOCALS=""
37
+ for f in "${PROJECT_FILES[@]}"; do
38
+ if [ -f "$f" ]; then
39
+ if grep -q "localhost:8000" "$f" 2>/dev/null; then
40
+ echo " ❌ FOUND in $f:"
41
+ grep -n "localhost:8000" "$f" | sed 's/^/ /'
42
+ FOUND_LOCALS="yes"
43
+ fi
44
+ fi
45
+ done
46
+ if [ -z "$FOUND_LOCALS" ]; then
47
+ echo " βœ… No 'localhost:8000' found in project files"
48
+ fi
49
+
50
+ echo ""
51
+ echo "2. Searching for ':8000' port pattern (excluding price values)..."
52
+ echo "----------------------------------------------------------------------"
53
+ FOUND_PORTS=""
54
+ for f in "${PROJECT_FILES[@]}"; do
55
+ if [ -f "$f" ]; then
56
+ # Look for patterns like 'port: 8000', 'port=8000', '-p 8000:8000', etc.
57
+ if grep -En "port.*8000|8000.*port|:8000[\"'\/]|localhost:8000" "$f" 2>/dev/null | grep -v "price\|target\|worst\|budget\|80000\|8000\." > /dev/null; then
58
+ matches=$(grep -En "port.*8000|8000.*port|:8000[\"'\/]|localhost:8000" "$f" 2>/dev/null | grep -v "price\|target\|worst\|budget\|80000\|8000\.")
59
+ if [ -n "$matches" ]; then
60
+ echo " ❌ FOUND in $f:"
61
+ echo "$matches" | sed 's/^/ /'
62
+ FOUND_PORTS="yes"
63
+ fi
64
+ fi
65
+ fi
66
+ done
67
+ if [ -z "$FOUND_PORTS" ]; then
68
+ echo " βœ… No port 8000 patterns found"
69
+ fi
70
+
71
+ echo ""
72
+ echo "3. Searching comments and docstrings for port references..."
73
+ echo "----------------------------------------------------------------------"
74
+ for f in "${PROJECT_FILES[@]}"; do
75
+ if [ -f "$f" ]; then
76
+ # Search in python files for comments with port references
77
+ if [[ "$f" == *.py ]]; then
78
+ if grep -En "#.*port.*8000|#.*8000.*port|port.*8000" "$f" 2>/dev/null; then
79
+ echo " ❌ Found comment in $f:"
80
+ grep -En "#.*port.*8000|#.*8000.*port|port.*8000" "$f" | sed 's/^/ /'
81
+ fi
82
+ fi
83
+ fi
84
+ done
85
+
86
+ echo ""
87
+ echo "4. Checking openenv.yaml and YAML configs for port values..."
88
+ echo "----------------------------------------------------------------------"
89
+ if [ -f "openenv.yaml" ]; then
90
+ if grep -n "port.*8000\|app_port.*8000" openenv.yaml 2>/dev/null; then
91
+ echo " ❌ FOUND port 8000 in openenv.yaml"
92
+ else
93
+ echo " βœ… openenv.yaml port is correctly set (checking full content...)"
94
+ grep -n "^port:" openenv.yaml 2>/dev/null || echo " No 'port:' line found"
95
+ grep -n "^app_port:" openenv.yaml 2>/dev/null || echo " No 'app_port:' line found"
96
+ fi
97
+ fi
98
+
99
+ echo ""
100
+ echo "5. Checking README.md for port references..."
101
+ echo "----------------------------------------------------------------------"
102
+ if [ -f "README.md" ]; then
103
+ echo " README.md port references:"
104
+ grep -n "port.*8000\|:8000\|localhost:8000" README.md 2>/dev/null | grep -v "price\|target\|worst\|budget\|#8000" | sed 's/^/ /' || echo " βœ… No port 8000 references found"
105
+ fi
106
+
107
+ echo ""
108
+ echo "6. Checking client.py example URLs..."
109
+ echo "----------------------------------------------------------------------"
110
+ if [ -f "client.py" ]; then
111
+ echo " client.py base_url examples:"
112
+ grep -n "base_url.*8000\|localhost:8000" client.py 2>/dev/null | sed 's/^/ /' || echo " βœ… No localhost:8000 references"
113
+ grep -n "example\|Example\|base_url" client.py 2>/dev/null | head -5 | sed 's/^/ /'
114
+ fi
115
+
116
+ echo ""
117
+ echo "=================================================="
118
+ echo " SUMMARY"
119
+ echo "=================================================="
120
+ echo ""
121
+ echo "Project source files checked: ${#PROJECT_FILES[@]}"
122
+ echo ""
123
+ echo "If you see no ❌ marks above, your project is clean."
124
+ echo "Only .playwright-mcp files may have old references (auto-generated, not source code)."
server/app.py CHANGED
@@ -62,6 +62,46 @@ def build_custom_gradio_ui(
62
  readme_content = _load_readme_content(metadata)
63
  display_title = metadata.name if metadata else title
64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  # Example actions for the Example tab
66
  EXAMPLE_1 = {
67
  "move_type": "make_offer",
@@ -555,8 +595,7 @@ def build_custom_gradio_ui(
555
 
556
  # Quick Start and README accordions
557
  with gr.Accordion("πŸ“˜ Quick Start Guide", open=False):
558
- if quick_start_md:
559
- gr.Markdown(quick_start_md)
560
  with gr.Accordion("πŸ“š Full README", open=False):
561
  gr.Markdown(readme_content)
562
 
 
62
  readme_content = _load_readme_content(metadata)
63
  display_title = metadata.name if metadata else title
64
 
65
+ # Custom Quick Start (override OpenEnv default which uses port 8000)
66
+ custom_quick_start_md = """### Connect to this environment
67
+
68
+ Connect from Python using `ProcureRLEnv`:
69
+
70
+ ```python
71
+ from client import ProcureRLEnv
72
+
73
+ # Connect to Hugging Face Space
74
+ with ProcureRLEnv.from_env("akshaypulla/procure-rl") as env:
75
+ result = await env.step(NegotiationAction(...))
76
+
77
+ # Or connect to local server
78
+ with ProcureRLEnv(base_url="http://localhost:7860") as env:
79
+ result = env.step(NegotiationAction(...))
80
+ ```
81
+
82
+ ### Web Interface
83
+
84
+ Access the visual playground at `/web` to:
85
+ - **Play Now**: Make offers and negotiate with the supplier
86
+ - **Watch Agent**: See a strategic agent negotiate step-by-step
87
+ - **Instructions**: Learn how to play and what each field means
88
+
89
+ ### API Endpoints
90
+
91
+ | Endpoint | Method | Description |
92
+ |----------|--------|-------------|
93
+ | `/reset` | POST | Reset environment with task_id and seed |
94
+ | `/step` | POST | Execute an action |
95
+ | `/state` | GET | Get current negotiation state |
96
+ | `/health` | GET | Health check |
97
+
98
+ ### Quick Tips
99
+
100
+ - Use **collaborative language** ("partnership", "mutual") to increase rapport
101
+ - In **multi_issue**, offering Net-30 payment can get you a better price
102
+ - In **adversarial**, avoid 2+ consecutive concessions or opponent hardens
103
+ """
104
+
105
  # Example actions for the Example tab
106
  EXAMPLE_1 = {
107
  "move_type": "make_offer",
 
595
 
596
  # Quick Start and README accordions
597
  with gr.Accordion("πŸ“˜ Quick Start Guide", open=False):
598
+ gr.Markdown(custom_quick_start_md)
 
599
  with gr.Accordion("πŸ“š Full README", open=False):
600
  gr.Markdown(readme_content)
601